import { createApp} from 'vue'
//引入element-plus的样式
import 'element-plus/dist/index.css'
import App from '@/App.vue'
import router from './router'
import 'normalize.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import api from '@/api'
import pinia from './store'
import useAuthStore from './store/modules/useAuthStore'
import {storeToRefs} from 'pinia'
import dynicRoute from './utils/dynicRoute'
const app=createApp(App)
//app.config.globalProperties.$api=api
app.provide('$api',api)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(pinia)
console.log('routes',router.getRoutes());
const store=useAuthStore()
const {authMenus}=storeToRefs(store)
if(authMenus&&authMenus.value.length>0){
    dynicRoute(authMenus.value)
}
app.use(router)

app.mount('#app')